﻿<UserControl x:Class="SPIWareMVVM.Views.PressMachineList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:me="clr-namespace:SPIWareMVVM.ViewModels" 
             xmlns:views="clr-namespace:SPIWareMVVM.Views"
             xmlns:ctrl="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ObjectDataProvider x:Key="applicationData" ObjectType="{x:Type me:ApplicationData}"/>
    </UserControl.Resources>
    <DockPanel>
        <ToolBar DockPanel.Dock="Top">
            <TextBlock DockPanel.Dock="Top" Text="Press Machines" Background="Azure" Width="75"/>
            <Separator/>
        </ToolBar>

        <ListBox DockPanel.Dock="Left" x:Name="lbPressMachine" ItemsSource="{Binding Path=ocMaterials, Source={StaticResource applicationData}, Mode=TwoWay}"
                 SelectionChanged="PressMachine_SelectionChanged"/>
        <DockPanel x:Name="dpPressMachineEdit" DockPanel.Dock="Top" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" >
                <TextBlock Text="("/>
                <TextBlock Text="{Binding SelectedItem.PressId, ElementName=lbPressMachine}"/>
                <TextBlock Text=") Machine #:"/>
                <TextBlock Text="{Binding SelectedItem.MachineNumber, ElementName=lbPressMachine}"/>
                <TextBlock Text=" Size:"/>
                <TextBlock Text="{Binding SelectedItem.PressSize, ElementName=lbPressMachine}"/>
            </StackPanel>
            <ToolBar DockPanel.Dock="Left" Background="MidnightBlue"/>
            <Grid DockPanel.Dock="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="85"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0" Grid.Row="0" Text="Machine #: "/>
                <TextBlock Grid.Column="0" Grid.Row="1" Text="Press Size: "/>
                <TextBlock Grid.Column="0" Grid.Row="2" Text="Press Rate: "/>
                <TextBlock Grid.Column="0" Grid.Row="3" Text="Operating Cost: "/>
                <TextBlock Grid.Column="0" Grid.Row="4" Text="Is Automated: "/>
                <TextBlock Grid.Column="0" Grid.Row="5" Text="Sort Order: "/>

                <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding SelectedItem.MachineNumber, ElementName=lbPressMachine}"/>
                <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding SelectedItem.PressSize, ElementName=lbPressMachine}"/>
                <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding SelectedItem.PressRate, ElementName=lbPressMachine}"/>
                <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding SelectedItem.PressOpCost, ElementName=lbPressMachine}"/>
                <TextBox Grid.Column="1" Grid.Row="4" Text="{Binding SelectedItem.IsAutomated, ElementName=lbPressMachine}"/>
                <TextBox Grid.Column="1" Grid.Row="5" Text="{Binding SelectedItem.SortOrder, ElementName=lbPressMachine}"/>
            </Grid>
        </DockPanel>
    </DockPanel>
</UserControl>
